package com.firstcare.android_dylibrary.bean;

import com.alibaba.fastjson.JSONObject;
import com.firstcare.android_dylibrary.DYApplication;
import com.firstcare.android_dylibrary.bean.base.BaseModelProxy;
import com.firstcare.android_dylibrary.network.URLSet;
import com.firstcare.android_dylibrary.network.request.ModelListRequest;
import com.rdxer.xxlibrary.HTTPUtils.listener.ErrorListener;
import com.rdxer.xxlibrary.HTTPUtils.listener.FailedListener;
import com.rdxer.xxlibrary.HTTPUtils.listener.OKListener;

import java.util.List;

/**
 * Created by chenyichao on 2016/8/18.
 */
public class ParameterProxy extends BaseModelProxy<Parameter> {
    public ParameterProxy(){

    }
    public ParameterProxy(Parameter report) {
        setModel(report);
    }
    /**
     *  不使用缓存
     */
    public static void getParameterProxyListNoCache(int rowstart, int rows, final OKListener<List<ParameterProxy>> okListener, FailedListener failedListener, ErrorListener errorListener) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("rowStart",rowstart);
        jsonObject.put("rows",rows);
        ModelListRequest<ParameterProxy> request = new ModelListRequest<ParameterProxy>(URLSet.getDefaultProjecttClient, jsonObject, okListener, failedListener, errorListener) {
            @Override
            protected Object getTargetData(JSONObject response) throws Exception{
                return response.getJSONObject("data").getJSONArray("esAttributeList");
            }//                                                     esAttributeList
        };
        DYApplication.getShared().getApi().addToRequestQueue(request);
    }
}
